package com.ruoyi.dash.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dash.domain.TbFutureOutlook;
import com.ruoyi.dash.service.ITbFutureOutlookService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 未来展望Controller
 * 
 * @author ruoyi
 * @date 2025-10-24
 */
@RestController
@RequestMapping("/dash/outlook")
public class TbFutureOutlookController extends BaseController
{
    @Autowired
    private ITbFutureOutlookService tbFutureOutlookService;

    /**
     * 查询未来展望列表
     */
    @PreAuthorize("@ss.hasPermi('dash:outlook:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbFutureOutlook tbFutureOutlook)
    {
        startPage();
        List<TbFutureOutlook> list = tbFutureOutlookService.selectTbFutureOutlookList(tbFutureOutlook);
        return getDataTable(list);
    }

    /**
     * 导出未来展望列表
     */
    @PreAuthorize("@ss.hasPermi('dash:outlook:export')")
    @Log(title = "未来展望", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbFutureOutlook tbFutureOutlook)
    {
        List<TbFutureOutlook> list = tbFutureOutlookService.selectTbFutureOutlookList(tbFutureOutlook);
        ExcelUtil<TbFutureOutlook> util = new ExcelUtil<TbFutureOutlook>(TbFutureOutlook.class);
        util.exportExcel(response, list, "未来展望数据");
    }

    /**
     * 获取未来展望详细信息
     */
    @PreAuthorize("@ss.hasPermi('dash:outlook:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(tbFutureOutlookService.selectTbFutureOutlookById(id));
    }

    /**
     * 新增未来展望
     */
    @PreAuthorize("@ss.hasPermi('dash:outlook:add')")
    @Log(title = "未来展望", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbFutureOutlook tbFutureOutlook)
    {
        return toAjax(tbFutureOutlookService.insertTbFutureOutlook(tbFutureOutlook));
    }

    /**
     * 修改未来展望
     */
    @PreAuthorize("@ss.hasPermi('dash:outlook:edit')")
    @Log(title = "未来展望", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbFutureOutlook tbFutureOutlook)
    {
        return toAjax(tbFutureOutlookService.updateTbFutureOutlook(tbFutureOutlook));
    }

    /**
     * 删除未来展望
     */
    @PreAuthorize("@ss.hasPermi('dash:outlook:remove')")
    @Log(title = "未来展望", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(tbFutureOutlookService.deleteTbFutureOutlookByIds(ids));
    }
}
